#include <iostream>
#include <stack>
using namespace std;

int main()
{
    string in;
    cin >> in;
    stack<char> s;
    for (unsigned int i=0; i<in.size(); ++i)
    {
        if (in[i] == '(') s.push('(');
        else if(in[i] == ')')
        {
            if (!s.empty()) s.pop();
            else {cout << "NO"; return 0;}
        }
    }
    if (!s.empty()) cout << "NO";
    else cout << "YES";
    return 0;
}
